<foreach name="agents" item="agent">
    <tr>
        <td><input type="checkbox" class="check_list" name="agent_id[]" value="{$agent['agent_id']}"/></td>
        <td>{$agent.agent_id}</td>
        <td>{$agent.agent_name}</td>
        <td>{$agent.mobile}</td>
        <td><a class="amt">{$agent.all_achi}</a></td>
        <td><a class="amt">{$agent.money}</a></td>
        <td>{:GetAgentNameById($agent['parent_id'])}</td>
        <td><if condition="$agent[invitation_code] eq '*'">是<else />否</if></td>
        <td><if condition='$agent[u_status] eq 1'>正常<elseif condition="$agent[u_status] eq '0'"/>关闭<else/>待审核</if></td>
        <td>
            <a class="btn-nrl" href="{:U('Agent/agent_view',array('id'=>$agent['agent_id']))}">查看</a>
            <a class="btn-nrl" onclick="money_edit({$agent.agent_id})" href="javascript:;">充值</a>
            <a class="btn-nrl" href="{:U('Agent/edit_agent',array('id'=>$agent['agent_id']))}">修改</a>
            <a class="btn-nrl" href="{:U('Agent/set_rank',array('id'=>$agent['agent_id']))}">代理</a>
            <a class="btn-nrl to_member" href="javascript:;" data-id="{$agent['agent_id']}" >转化</a>
            <!--<if condition="$agent['u_status'] eq 2">-->
                <!--<a class="btn-nrl" href="{:U('Agent/agent_audit',array('id'=>$agent['agent_id']))}">审核</a>-->
            <!--</if>-->
        </td>
    </tr>
</foreach>
<tr><td colspan="10">{$page}</td></tr>

<script type="text/javascript">
    $(document).ready(function(){
        $(".pagination a").click(function(){
            cur_page = $(this).data('p');
            ajax_get_table(cur_page);
        });

        $(function(){
            $('.changeS').click(function ()
            {
                var do_type = $(this).attr("do");
                layer.confirm('您确认进行此操作吗？', {
                    btn: ['确认','取消']
                }, function(){
                    $("#do_type").attr("value", do_type);
                    $("#smt").submit();
                });
            });

            $('.to_member').click(function (){
                var agent_id = $(this).data("id");
                layer.confirm('您确认要将此代理转成普通用户吗？', {
                    btn: ['确认','取消']
                }, function(){
                    $.ajax({
                        url:"{:U('Agent/to_member')}",
                        type : "get",
                        data : { id :agent_id },
                        success: function(data){
                            if(data.status == "success"){
                                layer.msg("操作成功" ,{time: 1500});
                                setTimeout(function(){
                                    location.reload(true);
                                } ,1500);
                            }
                        }
                    });
                });
            });
        });
    });
</script>